<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>推广素材</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<style>
	.pic_param{
		width:50px;
	}
	.pic_param_box{
		margin:15px auto;
	}
</style>
<script src="<{$config.weburl}>/script/jquery-1.4.4.min.js" type="text/javascript" charset="utf-8" ></script>
<script src="<{$config.weburl}>/script/my_lightbox.js" type="text/javascript" charset="utf-8"></script>
<script src="<{$config.weburl}>/script/district.js" type="text/javascript" charset="utf-8"></script>
<script src="<{$config.weburl}>/script/jquery.json-2.4.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
	<div class="container">
        <div class="flow">
            <div class="itemtitle">
                <h3>素材</h3>
                <ul>
                    <li <{if $smarty.get.operation==''}>class="current"<{/if}>><a href="?m=micro_shop&s=expand_material.php"><span>管理</span></a></li>
                    <li <{if $smarty.get.operation=='add'}>class="current"<{/if}>><a href="?m=micro_shop&s=expand_material.php&operation=add"><span>添加</span></a></li>
                    <{if $smarty.get.operation=='edit'}>
                    <li class="current"><a href="javascript:void(0);"><span>修改</span></a></li>
                    <{/if}>
                </ul>
            </div>
        </div>
        <div class="h35"></div>  
        <{if $smarty.get.operation=='add' or $smarty.get.operation=='edit' }>
            <form name="form" id="form" method="post" enctype="multipart/form-data">
            <input name="id" type="hidden" id="id" value="<{$de.id}>">
            <table class="table" id="base">
                <thead>
                    <tr>
                        <th class="partition" colspan="99">素材</th>
                    </tr>
                </thead>
                <tbody>
                <tr>
                    <td width="100">标题</td>
                    <td>
                    <textarea name="title" id="title" class="w350"><{$de.title}></textarea>
                    </td>
                </tr>
                
                <tr>
			        <td>上传图片</td>
			        <td>
			            <div class="product_image">
			                <ul id="list1" style="width:380px;">
			                    <{foreach item=list key=key from=$de.picArr}>
			                        <li id="p<{$key+1}>" data-itemid='<{$key+1}>'>
			                            <div class="product_image_list">
			                            	<div class="show_big"></div>
			                                <div nc_type="handle_image">
			                                    <div class="image">
			                                    	
			                                    <input name="pic[]" type="hidden" id="img<{$key}>" value="<{$list}>" />
			                                    <{if $list}>
			                                    <img id="img<{$key}>_img" src="<{$list}>" picKey="<{$key}>" width="60">
			                                    <{else}>
			                                    <img width="60" id="img<{$key}>_img" picKey="<{$key}>" src="<{$config.weburl}>/image/default/nopicsmall.gif"  />
			                                    <{/if}>
			                                    </div>
			                                    <div nc_type="handle" class="bg">
			                                    <span title="删除" nctype="delete_image">删除</span>
			                                    </div>
			                                </div>
																			
			                                <div class="upload-btn"><a class="upload-button" href="javascript:uploadfile('Style images','img<{$key}>',0,0,'material')">上传</a></div>
			                            </div>
			                        </li>
			                    <{/foreach}>
			                    <{assign var=count value=$de.picArr|@count}>
			                    <{section name=name loop=$count*-1+6}>
			                        <li id="p<{$key+$smarty.section.name.index+1}>" data-itemid='<{$key+$smarty.section.name.index+1}>'>
			                            <div nc_type="handle_image">
			                                <div class="image">
			                                    <input name="pic[]" type="hidden" id="pic<{$smarty.section.name.index}>" value="" />
			                                    <img width="60" id="pic<{$smarty.section.name.index}>_img" picKey="<{$count+$smarty.section.name.index+1}>" src="<{$config.weburl}>/image/default/nopicsmall.gif"  />
			                                </div>
			                                <div nc_type="handle" class="bg">
			                                <span title="删除" nctype="delete_image" class="delete">删除</span>
			                                </div>
			                            </div>
			                            <div class="upload-btn"><a class="upload-button" href="javascript:uploadfile('Style images','pic<{$smarty.section.name.index}>',0,0,'material')">上传</a></div>
			                        </li>
			                    <{/section}>
			                </ul>
			            </div>
			        </td>
			    </tr>
                
                <tr>
                	<td>图片上二维码相关参数</td>
                	<td>
                		<div class="product_image">
			                <ul id="list2" style="width:380px;">
			                <{foreach item=list key=key from=$de.picParam}>
		                        <li>
		                            <div class="pic_param_box">边长&nbsp;&nbsp;&nbsp;<input type="text" class="pic_param" name="pic_param_size[]" id="pic_param_size_<{$key}>" value="<{$list.side}>"/>px</div>
		                            <div class="pic_param_box">距右边<input type="text" class="pic_param" name="pic_param_right[]" id="pic_param_right_<{$key}>" value="<{$list.right}>"/>px</div>
		                            <div class="pic_param_box">距底部<input type="text" class="pic_param" name="pic_param_bottom[]" id="pic_param_bottom_<{$key}>" value="<{$list.bottom}>"/>px</div>
		                        </li>
		                    <{/foreach}>
		                    <{assign var=count1 value=$de.picParam|@count}>
			                <{section name=pic_param loop=$count1*-1+6}>
		                        <li>
		                            <div class="pic_param_box">边长&nbsp;&nbsp;&nbsp;<input type="text" class="pic_param" name="pic_param_size[]" id="pic_param_size_<{$count1+$smarty.section.pic_param.index+1}>" value="150"/>px</div>
		                            <div class="pic_param_box">距右边<input type="text" class="pic_param" name="pic_param_right[]" id="pic_param_right_<{$count1+$smarty.section.pic_param.index+1}>" value="12"/>px</div>
		                            <div class="pic_param_box">距底部<input type="text" class="pic_param" name="pic_param_bottom[]" id="pic_param_bottom_<{$count1+$smarty.section.pic_param.index+1}>" value="12"/>px</div>
		                        </li>
		                    <{/section}>
			                </ul>
		                </div>
                	</td>
                </tr>
                
                <tr>
                    <td>展示状态</td>
                    <td>
                    <input type="radio" name="status" value="1" id="open" <{if $de.status==1}>checked="checked"<{/if}>/><label for="open">开启</label>
                     <input type="radio" name="status" value="2" id="open" <{if $de.status==2}>checked="checked"<{/if}>/><label for="open">推荐</label>
                    <input type="radio" name="status" value="0" id="close" <{if $de.status==0}>checked="checked"<{/if}>/><label for="close">关闭</label>
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td>
                    <input class="submit" type="submit" value="提交">
                    <input name="act" type="hidden" id="action" value="<{if !$smarty.get.editid}>save<{else}>edit<{/if}>">
                    </td>
                </tr>
                </tbody>
            </table>
            </form>
        <{else}>
        <form action="" method="get">
    <input type="hidden" name="m" value="micro_shop">
    <input type="hidden" name="s" value="expand_material.php">
    <table class="select_table">
        <tbody>
            <tr>
                <td width="60">状态：</td> 
                
                <td width="80">
                	<select name="statu" id="statu">
                		<option value="">全部</option>
                		<option value="1" <{if "1"===$smarty.get.statu}>selected="selected"<{/if}>>开启</option>
                		<option value="2" <{if "2"===$smarty.get.statu}>selected="selected"<{/if}>>推荐</option>
                		<option value="0" <{if "0"==$smarty.get.statu}>selected="selected"<{/if}>>关闭</option>
                	</select>
                </td>
                <td><input type="image" src="<{$config.weburl}>/image/admin/search.gif" /></td>
            </tr>
            
        </tbody>
    </table>
    </form>
        <form action="" method="post">
        <table class="table">
        	<thead>
                <tr>
                    <th class="partition" colspan="99">活动列表</th>
                </tr>
            </thead>
            <tbody>
                <tr class="header">
                    <th width="50">ID</th>
                    <th>标题</th>
                    <th width="60">状态</th>
                    <th width="100">创建时间</th>
                    <th width="100">操作</th>
                </tr>
                <{foreach item=list from=$de.list}>
                <tr>
                    <td><{$list.id}></td>
                    <td><{$list.title}></td>
                    <td><{if $list.status==1}>开启<{elseif $list.status==2}>推荐<{else}>关闭<{/if}></td>
                    <td><{$list.create_time}></td>
                    <td>
                    	<a href="?m=micro_shop&s=expand_material.php&operation=edit&editid=<{$list.id}><{$cond}>"><{$editimg}></a> 
                    </td>
                </tr>
                <{foreachelse}>
                <tr>
                    <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
                </tr>
                <{/foreach}>
            </tbody>
            <tfoot>
                <tr>
                	<td colspan="99">
                    	<div class="page"><{$de.page}></div>
                    </td>
                </tr>
            </tfoot>
        </table>
        </form>
        <{/if}>
    </div>
</body>
<script type="text/javascript" src="<{$config.weburl}>/script/microShop.js" charset="utf-8"></script>
<script type="text/javascript" src="<{$config.weburl}>/script/jquery.dragsort-0.5.1.min.js" charset="utf-8"></script>
<script type="text/javascript">
$('.itemtitle ul li').unbind().each(function(){
	$(this).click(function(){
		id=$(this).children().attr('id');
		$(this).addClass("current").siblings().removeClass("current");	
		if(id=='base')
			$(".container").find("table").removeClass("hidden");
		else
			$(".container").find("#"+id).removeClass("hidden").siblings(".table").addClass("hidden");	
	});
});

var rowtypedata = [
	[
		[1, ''], 
		[1, '', 'al'], 
		[1, ''], 
		[1, ''], 
		[1, ''], 
		[1, ''],
		[1, ''],
		[1, ''],
		[1, '<div><a href="javascript:;" class="deleterow" onClick="deleterow(this,{1})">删除</a></div>']
	
	]
];
var addrowdirect = 0;
var addrowkey = 0;
function addrow(name, type) {
	
	$('#'+name+'_tr').show();
	var obj=$('#'+name+'_button')[0];	
	var table = obj.parentNode.parentNode.parentNode.parentNode;
	var iframe=window.parent.document.getElementById("iframe_"+name).contentWindow;
	var tab=iframe.document.getElementById(name+"_table");
	var checkbox= $(tab).find("input[class='checkitem']:checked");
	var typedata = rowtypedata[type];
	$.each(checkbox,function(i){
		var value1=$("#hidden_"+name).val();
		var value2=this.value
		if(value1.indexOf(','+value2+',') <= 0 )
		{
			$("#hidden_"+name).val(value1+value2+',');	
			var tr=$(this).parent().parent();
			if(!addrowdirect) {
				var row = table.insertRow(obj.parentNode.parentNode.rowIndex);
			} else {
				var row = table.insertRow(obj.parentNode.parentNode.rowIndex + 1);
			}
			for(var i = 0; i <= typedata.length - 1; i++) {
				if(i<=8)
				{
					var cell = row.insertCell(i);
					if(i==8)
					{
						var tmp = typedata[i][1];
					}
					else
					{
						var tmp = tr.find('td')[i+1].innerHTML;
					}
					if(i==1){
						cell.className = typedata[i][2];
					}
					tmp = tmp.replace(/\{(n)\}/g, function($1) {return addrowkey;});
					tmp = tmp.replace(/\{(\d+)\}/g, function($1, $2) { return value2+',\''+name+'\''; });
					cell.innerHTML = tmp;
				}
			}
			addrowkey ++;
			addrowdirect =0;
		}
	});
}

function deleterow(obj,id,name) {
	var table = obj.parentNode.parentNode.parentNode.parentNode.parentNode;
	var tr = obj.parentNode.parentNode.parentNode;
	var value=$("#hidden_"+name).val();

	var pattern = ','+id+',';
	str = value.replace(new RegExp(pattern), ",");
	$("#hidden_"+name).val(str);
	table.deleteRow(tr.rowIndex);
}

$("#list1").dragsort({ dragSelector: "div", dragSelectorExclude:"span",dragBetween: true, dragEnd: saveOrder, placeHolderTemplate: "<li class='placeHolder'><div></div></li>" });

function saveOrder()
{
	var data = $("#list1 li").map(function() { return $(this).data("itemid"); }).get();
};

function load_pic()
{
	

	
	$.getScript("<{$config.weburl}>/script/microShop.js",function(){
			$('[nc_type="handle_image"]').each(function(){
				
		if(!$(this).find(':input').val()){
			
			return true;
		}
		else if($(this).parent().find('.show_big').size()){
			return true;
		}
		else{
			var $d=$('<div class="show_big"></div>').hover(function(){
				var _left=$(this).offset().left;
				var _top =$(this).offset().top;
				var picNode = $(this).next().find('img');
				var picSrc = picNode.attr('src');
				var picKey = picNode.attr('picKey');
				var picSide = $('#pic_param_size_'+picKey).val();
				var picRight = $('#pic_param_right_'+picKey).val();
				var picBottom = $('#pic_param_bottom_'+picKey).val();
				if(picSide>0){
					var $$="http://wx.52ywy.com/Qrcode/showMix?pic="+encodeURIComponent(picSrc)+"&shop=14441&side="+picSide+"&right="+picRight+"&bottom="+picBottom;
				}else{
					var $$=picSrc;
				}
				$('<img id="biger_img" width="300" style="position:absolute;z-index:9999;left:'+(_left-(-11))+'px;top:'+(_top-(-11))+'px;"/>').attr('src',$$).appendTo($(document.body));
			},function(){
				$('#biger_img').remove();
			})
			$(this).before($d);
		}
	});
	});
}

/*-------------销售属性------------------*/
var property_checked = [<{foreach item=list key=num from=$firstvalue.d}><{if $num+1==$firstvalue.d|@count}>''<{else}>'',<{/if}><{/foreach}>];
var str = '';
var property_color;
var V = new Array();
<{foreach item=list key=num from=$firstvalue.d}>
var property_checked_<{$num}> = new Array();
<{if $list.field=='color'}>
 property_color=<{$num}>;
<{/if}>
<{/foreach}>

$(function(){
	/************zx************/
	$('input[name=code]').css('background','#E7E7E7 none');
	
	/* $('input[name="amount"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	
	$('input[name="price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	$('input[name="show_price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	$('input[name="cost_price"]').attr('readonly','readonly').css('background','#E7E7E7 none'); */

	/*************zx****************/
	
	
	
	$('tbody[nc_type="property_table"]').find('input[type="text"]').live('change',function(){
		s = $(this).attr('nc_type');
		V[s] = $(this).val();
	});
	$('span[nc_type="chk"] > input[type="checkbox"]').click(function(){
		into_set();
	});
	$('span[nc_type="chk"] > input[type="checkbox"]').click(function(){
		stock_set();
	});
	
	
	$('a[nc_type="set_weight"]').click(function(){
		
		weight_set();
		
	})
	
	$('input[data_type="stock"]').live('change',function(){
		//count_stock();
	});
	$('input[data_type="sku"]').live('change',function(){
		//code();
	});
	$('input[data_type="price"]').live('change',function(){
		count_price('price');
		count_price('dis_price');
	});
	$('input[data_type="dis_price"]').live('change',function(){
		count_price('price');
		count_price('dis_price');
	});
	$('input[data_type="declared_price"]').live('change',function(){
		count_price('declared_price');
	});
	$('input[data_type="market_price"]').live('change',function(){
		count_price('market_price');
	});
	$('#color').find('input[type="checkbox"]').click(function(){
		pic_show($(this));
	});
	
	$('input[type="submit"]').click(function(){
		$('input[data_type="price"]').each(function(){
			if($(this).val() == ''){
				$(this).val($('input[name="price"]').val());
			}
		});
		$('input[data_type="stock"]').each(function(){
			if($(this).val() == ''){
				$(this).val('0');
			}
		});
		if($('dl[nc_type="property_tbody"]').css('display') == 'none'){
			$('dl[nc_type="property_tbody"]').find('input').attr('disabled','disabled');
		}
	});
	
});

function into_set(){
	
	<{foreach item=list key=num from=$firstvalue.d}>
	property_checked_<{$num}> = new Array();
	
	if($('input[type="checkbox"][ignore_type="property_td_<{$num}>"]').is(':checked')){
	$('td[nc_type="property_td_<{$num}>"]').find('input[type="checkbox"]:checked').each(function(){
		v = $(this).attr('nc_type');
		i = $(this).val();
	
		property_checked_<{$num}>[property_checked_<{$num}>.length] = [v,i];
	});
	}else if($('input[ignore_type]:checked').size()>0){
		property_checked_<{$num}>[0] = ['-',0];
	}
	property_checked[<{$num}>] = property_checked_<{$num}>;
	<{/foreach}>

}

function weight_set(){
	
	if($('tbody[nc_type="property_table"]').is(':hidden')){
		return;
	}
	
	var wt=$('#weight').val();
	
	$('table[id=spec]').find('input').eq(0).focus();
	$('input[data_type="weight"]').attr('readonly','').css('background','').each(function(){
		if(!parseFloat($(this).val())){
			$(this).val(wt);
		}
		
	}).eq(0).focus();
}



function stock_set(){
	
	/* $('input[name="price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	$('input[name="show_price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	$('input[name="cost_price"]').attr('readonly','readonly').css('background','#E7E7E7 none'); */
	$('input[name="code"]').attr('readonly','readonly').css('background','#E7E7E7 none');
	
	$('tbody[nc_type="property_tbody"]').show();
	$('#default_sku_setting').hide();
	str = '<tr>';
		
	<{$abc}>
	
	if(str == '<tr>'){
		//$('input[name="price"]').attr('readonly','').css('background','');
		//$('input[name="show_price"]').attr('readonly','').css('background','');
		//$('input[name="cost_price"]').attr('readonly','').css('background','');
		//$('input[name="amount"]').attr('readonly','').css('background','');
		//$('input[name="code"]').attr('readonly','').css('background','');
		$('tbody[nc_type="property_tbody"]').hide();
		$('#default_sku_setting').show();
	}
	
	var i=0;
	$('tbody[nc_type="property_table"]')
		.empty()
		.html(str)
		.find('input[type="text"]').each(function(){
			s = $(this).attr('nc_type');
			try{$(this).val(V[s])}catch(ex){$(this).val('')};
			if($(this).attr('data_type') == 'price' && $(this).val() == ''){
				$(this).val($('input[name="price"]').val());
			}
			if($(this).attr('data_type') == 'dis_price' && $(this).val() == ''){
				$(this).val($('input[name="dis_price"]').val());
			}
			if($(this).attr('data_type') == 'declared_price' && $(this).val() == ''){
				$(this).val($('input[name="declared_price"]').val());
			}
			if($(this).attr('data_type') == 'market_price' && $(this).val() == ''){
				$(this).val($('input[name="market_price"]').val());
			}
			if($(this).attr('data_type') == 'sku' && $(this).val() == ''){
				$(this).val('添加商品自动生成');
			}
			if($(this).attr('data_type') == 'buy_limit' && $(this).val() == ''){
				$(this).val($('input[name="buy_limit"]').val());
			}
		});
	//count_stock();
	count_price('price');
	count_price('dis_price');
	count_price('declared_price');
	count_price('market_price');
	//code();
}

function count_stock(){
	var stock = 0;
	$('input[data_type="stock"]').each(function(){
		if($(this).val() != ''){
			stock += parseInt($(this).val());
		}
	});
	$('input[name="amount"]').val(stock);
}

function code(){
	var max = 0.01;
	var min = 10000000;
	$('input[data_type="sku"]').each(function(){
		if($(this).val() != ''){
			max = Math.max(max,$(this).val());
			min = Math.min(min,$(this).val());
		}
	});
	if($('input[name="code"]').val()!='0' && !$('input[name="code"]').val())
	{
		if(min != 10000000){
			$('input[name="code"]').val(min);
		}
	}
}

function count_price(obj){
	var max = 0.01;
	var min = 10000000;
	$('input[data_type="'+obj+'"]').each(function(){
		if($(this).val() != ''){
			max = Math.max(max,$(this).val());
			min = Math.min(min,$(this).val());
		}
	});
	if(min != 10000000){
		$('input[name="'+obj+'"]').val(min.toFixed(2));
	}
}

function pic_show(Obj){
	var V = $('#color').find('input[type="checkbox"]:checked');
	if(V.length == 0){	
		$('table[nc_type="color_img"]').hide();
	}else{
		$('table[nc_type="color_img"]').show();
	}
	var S = $('tr[id="color_img_tr_'+Obj.val()+'"]');
	if(S.css('display') == 'none'){
		S.show();
	}else{
		S.hide();
	}
}


function choose_pic(obj)
{	
	var pic_info='';
	
	$.each($(":input[name='pic\[\]']"),function(k,v){
		if(!$(v).val())return;
		//alert($(v).val());
		pic_info+='<li><div class="image"><img src="'+$(v).val()+'" width="60"></div><div class="upload-btn" style="cursor: pointer;"><a href="javascript:;" chose_pic="'+$(v).val()+'" class="upload-button">设为首图</a></div></li>';
		
	});
	
	if(pic_info==''){
		pic_info='<li>无可选图片，<br/>请先上传</li>';
	}
	
	
	
	alertWin('选择图片', '<div class="product_image"><ul>'+pic_info+'</ul></div>',650, 330);
	$('[chose_pic]').click(function(){
		//alert(obj);
		$('#'+obj).val($(this).attr('chose_pic'));
		$('#'+obj+'_img').attr('src',$(this).attr('chose_pic'));
		$('#'+obj+'_del').html('<a href="javascript:;">(删)</a>');
		close_win();
	})
}

$(function(){
	$('[del_id]').each(function(){ 
		var $span=$(this);var delid=$span.attr('del_id');
		$(this).find('a').live('click',function(){
			//alert($del_id);
			$span.html('(无)');
			$('#'+delid).val('');
			$('#'+delid+'_img').attr('src','../image/default/user_admin/transparent.gif');
		})
		
	})
	$('.imgs[id^=color_img]').live('hover',function(event){
			if(event.type=='mouseenter'){
				var _left=$(this).offset().left;
				var _top =$(this).offset().top;
				var $$=$(this).attr('src');
				$('<img id="biger_img" width="300" height="300" style="position:absolute;z-index:999;left:'+(_left-(-15))+'px;top:'+(_top-(-15))+'px;"/>').attr('src',$$).appendTo($(document.body));
			}else{
				$('#biger_img').remove();
			}
}) 
	
	
	
});


$(function(){
	var E_SP = new Array();
	var E_SPV = new Array();
	<{foreach item=list from=$de.porperty}>
		<{foreach item=slist from=$list.setmeal}>
				<{foreach item=val key=num from=$slist}>
					E_SP[<{$num}>] = '<{$val}>';
					<{/foreach}>
						<{/foreach}>	
			E_SPV['i_<{$list.property_value_id}>|price'] = '<{$list.price}>';
			E_SPV['i_<{$list.property_value_id}>|dis_price'] = '<{$list.dis_price}>';
			E_SPV['i_<{$list.property_value_id}>|declared_price'] = '<{$list.declared_price}>';
			E_SPV['i_<{$list.property_value_id}>|market_price'] = '<{$list.market_price}>';
			E_SPV['i_<{$list.property_value_id}>|stock'] = '<{$list.stock}>';
			E_SPV['i_<{$list.property_value_id}>|sku'] = '<{$list.code}>';
			E_SPV['i_<{$list.property_value_id}>|buy_limit'] = '<{$list.buy_limit}>';
			E_SPV['i_<{$list.property_value_id}>|weight'] = '<{$list.weight}>';

	<{/foreach}>
	
	V = E_SPV;
	
	
	$('.firstvalue').find('input[type="checkbox"]').each(function(){
		/* $('input[name="price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
		$('input[name="show_price"]').attr('readonly','readonly').css('background','#E7E7E7 none');
		$('input[name="cost_price"]').attr('readonly','readonly').css('background','#E7E7E7 none'); 
		$('input[name="amount"]').attr('readonly','readonly').css('background','#E7E7E7 none');*/
		$('input[name="code"]').attr('readonly','readonly').css('background','#E7E7E7 none');
		$('tbody[nc_type="property_tbody"]').show();
	});

	into_set();
	str = '<tr>';
	
	<{$abc}>
	
	if(str == '<tr>'){
		
		//$('input[name="price"]').attr('readonly','').css('background','');
		//$('input[name="show_price"]').attr('readonly','').css('background','');
		//$('input[name="cost_price"]').attr('readonly','').css('background','');
		//$('input[name="amount"]').attr('readonly','').css('background','');
		//$('input[name="code"]').attr('readonly','').css('background','');
		$('tbody[nc_type="property_tbody"]').hide();
		$('#default_sku_setting').show();
	}
	
	
	if($('input[ignore_type]:checked').size()==0){
		$('tbody[nc_type="property_tbody"]').hide();
		$('#default_sku_setting').show();
	}

	$('tbody[nc_type="property_table"]')
		.empty()
		.html(str)
		.find('input[type="text"],input[type="hidden"]').each(function(){
			if($(this).is('[stock]')){
				$(this).attr('stock',$(this).siblings('input').val());
				var $stock=$(this);
				$.get('<{$config.weburl}>/admin/module.php?m=product&s=inventory_api.php&stock='+$(this).attr('stock'),function(data){
					$stock.val(data);
				});
			}else{
				s = $(this).attr('nc_type');
				if(s!='sp_value'){
					try{$(this).val(E_SPV[s])}catch(ex){$(this).val('')};	
				}
			}
		});
	
	$('#color').find('input[type="checkbox"]:checked').each(function(){
		pic_show($(this));
	});
});
/**********************zx**************/

</script>
</html>